<!DOCTYPE html>
<html>
    <head>
    <link rel="stylesheet" type="text/css" href="css/Home.css" />
    <title>Home</title>
    <link rel="stylesheet" type="text/css" href="engine1/style.css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta name="keywords" content="WOW Slider, Wordpress Gallery Slider, Wordpress Photo Slider" />
    <meta name="description" content="WOWSlider created with WOW Slider, a free wizard program that helps you easily generate beautiful web slideshow" />
    <script language="javascript" type="text/javascript" src="engine1/jquery.js"></script>
    </head>
<?php include_once('master_menu.php');?>
<div class="page">
  <div class="left">
    <div class="chude">
      <div id="tieude">
        <div id="t1"><img src="images/audio_headphones.png" /><b>Việt Nam</b></div>
        <div class="tieude">
          <ul>
            <?php
                $conn = mysql_connect("localhost", "root","123456") or die("Ket noi den MySQL that bai");
                mysql_select_db("mp3", $conn);
                mysql_query("SET NAMES UTF8",$conn);
                $sql = "select * from `nghesi` where quoctich='Việt Nam';";
                $q = mysql_query($sql);
                while ($row= mysql_fetch_array($q))
                {
                    $nghesi=$row["nghedanh"];
                    $id=$row["id_nghesi"];
            ?>
            <li><a href="artist_page.php?id=<?=$id?>"><?=$nghesi?></a></li>
            <?php
            
                }
            ?>
          </ul>
        </div>
      </div>
    </div>
    <div class="chude">
      <div id="tieude">
        <div id="t1"><img src="images/audio_headphones.png" /><b>US-UK</b></div>
        <div class="tieude">
          <ul>
             <?php
                $sql = "select * from `nghesi` where quoctich like 'United%';";
                $q = mysql_query($sql);
                while ($row= mysql_fetch_array($q))
                {
                    $nghesi=$row["nghedanh"];
                    $id=$row["id_nghesi"];
            ?>
                <li><a href="artist_page.php?id=<?=$id?>"><?=$nghesi?></a></li>
            <?php
                }
            ?>
          </ul>
        </div>
      </div>
    </div>
    <div class="chude">
      <div id="tieude">
        <div id="t1"><img src="images/audio_headphones.png" /><b>Châu Á</b></div>
        <div class="tieude">
          <ul>
             <?php
                $sql = "select * from `nghesi` where quoctich like 'United%';";
                $q = mysql_query($sql);
                while ($row= mysql_fetch_array($q))
                {
                    $nghesi=$row["nghedanh"];
                    $id=$row["id_nghesi"];
            ?>
                <li><a href="artist_page.php?id=<?=$id?>"><?=$nghesi?></a></li>
            <?php
                }
             ?>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class="content">
<!-- Chuyển slide-->
    <div class="banner">
   	<!-- Start WOWSlider.com BODY section -->
	<div id="wowslider-container1">
	<div class="ws_images">
    	<ul>
            <li><img src="data1/images/jpeg.jpg" alt="Đông Nhi - Tìm Về" title="Đông Nhi - Tìm Về" id="wows1_0"/></li>
            <li><img src="data1/images/jpeg1.jpg" alt="Tiên Cookie ft Justa Tee & BigDaddy - Thời Gian Sẽ Trả Lời" title="Tiên Cookie ft Justa Tee & BigDaddy - Thời Gian Sẽ Trả Lời" id="wows1_1"/></li>
            <li><img src="data1/images/jpeg2.jpg" alt="Lynk Lee - Nắm Chặt Tay Anh Nhé" title="Lynk Lee - Nắm Chặt Tay Anh Nhé" id="wows1_2"/></li>
            <li><img src="data1/images/jpeg3.jpg" alt="Phương Vy - Quên Một Người" title="Phương Vy - Quên Một Người" id="wows1_3"/></li>
        </ul>
    </div>
<div class="ws_bullets"><div>
<a href="#" title="jpeg"><img src="data1/tooltips/jpeg.jpg" alt="jpeg"/>1</a>
<a href="#" title="jpeg1"><img src="data1/tooltips/jpeg1.jpg" alt="jpeg1"/>2</a>
<a href="#" title="jpeg2"><img src="data1/tooltips/jpeg2.jpg" alt="jpeg2"/>3</a>
<a href="#" title="jpeg3"><img src="data1/tooltips/jpeg3.jpg" alt="jpeg3"/>4</a>
</div></div>
<a class="wsl" href="http://wowslider.com">Wordpress Slider Plugins by WOWSlider.com v2.9</a>
	<div class="ws_shadow"></div>
	</div>
	<script type="text/javascript" src="engine1/wowslider.js"></script>
	<script type="text/javascript" src="engine1/script.js"></script>
    </div>   
<!--  php album  -->
    <div class="albumhot">
      <div class="albumhotbanner"></div>
          <?php
    $sql = "select * from nghesi  
inner join album on nghesi.id_nghesi=album.id_nghesi limit 6;";
    
    $q = mysql_query($sql);
    
    while ($row= mysql_fetch_array($q))
    {
        $album=$row["id_album"];
        $tenalbum=$row["tenalbum"];
        $view=$row["view"];        
        $pic=$row["pic"];
        $tencs=$row["nghedanh"];
        $id=$row["id_nghesi"];
?>   
      <div class="pic_album"> <a href="#"><img src="<?=$pic?>" /></a>
        <div class="metaalbum"> <a id="a1" href="chitietalbum.php?id=<?=$album?>&idcs=<?=$id?>"><?=$tenalbum?></a><br />
          <a href="artist_page.php?id=<?=$id?>" id="a2"><?=$tencs?></a>
        </div>
      </div>    
    <?php
    }
    
?>  
    </div>
    <!-- php video-->
    <div class="videohot">
      <div class="v1"></div>
       <?php
    $sql = "select * from music_nghesi 
    inner join music on music_nghesi.id_music=music.id_music 
    inner join nghesi on music_nghesi.id_nghesi=nghesi.id_nghesi where music.loai = 1;";
    $q = mysql_query($sql);
    
    while ($row= mysql_fetch_array($q))
    {
        $baihat=$row["id_music"];
        $id=$row["id_nghesi"];
        $tenbh=$row["tenmusic"];
        $view=$row["view"];
        $tencs=$row["nghedanh"];
        $pic=$row["pic"];
        
?>     
     
      <div class="pic_video2">
       <a class="a1" href="chitietvideo.php?id=<?=$baihat?>&idcs=<?=$id?>">
      <img src="images-video/<?=$pic?>" style="width: 128px; height: 72px;" /></a>
        <div class="meta"> <a class="a1" href="chitietvideo.php?id=<?=$baihat?>&idcs=<?=$id?>"><?=$tenbh?></a><br />
          <a href="artist_page.php?id=<?=$id?>" id="a2"><?=$tencs?></a></div>
      </div>
    
    
    <?php
    }
?>
   </div>
<!--   php music-->
    <div class="toplist">
      <div class="banlist"></div>
    <?php
    $sql = "select * from music_nghesi 
    inner join music on music_nghesi.id_music=music.id_music 
    inner join nghesi on music_nghesi.id_nghesi=nghesi.id_nghesi 
    ORDER BY RAND(music.id_music);";
    $q = mysql_query($sql);
    while ($row= mysql_fetch_array($q))
    {
        $baihat=$row["id_music"];
        $id=$row["id_nghesi"];
        $tenbh=$row["tenmusic"];
        $view=$row["view"];
        $tencs=$row["nghedanh"];
        $link=$row["link"];
        
    ?>  
      <form class="toplist1" action="" method="post">
        <h3><a href="chitietbh.php?id=<?=$baihat?>&idcs=<?=$id?>"><?=$tenbh?></a></h3>
        <p>Trình bày: <a href="artist_page.php?id=<?=$id?>"><?=$tencs?></a> | Lượt nghe:<?=$view?></p>
        <?php 
            if(isset($_SESSION["login"])&& $_SESSION["login"]!=NULL)
            {
               echo ("<div class='iconlist'>". 
                    "<a class='icondownload' href=nhac/".$link.">&emsp;&emsp;</a>".
                    "<input type='submit' class='iconadd' value='' /><input type='hidden' name='hid' value='$baihat'/>".
                    "<select class='selectpl' name='id$baihat'>");
                $sql = mysql_query("select a.* from playlist a, user b where  b.id_user=a.id_user and b.username= '".$_SESSION["login"]."'");
                while ($row= mysql_fetch_array($sql))
                {
                    $ten=$row["tenplaylist"]; 
                    $id_pl=$row["id_playlist"]; 
                             
                 echo("<option value='$id_pl'>$ten</option>");
                   
                }
                echo ("</select>".
                    "</div>");
            }
        ?>

      </form>
        <?php               
        } 
            if(isset($_POST['hid']))
            {
            $bh=$_POST['hid'];
            $sel=$_POST["id$bh"];
            $str = "call insertms_pl(" . $bh . "," . $sel . ")";
            $r=mysql_query($str);
            //$result=mysql_fetch_row($r);//lấy id của playlist mới add vào
            }     
    mysql_close($conn);
?>
    </div>
  </div>

<?php include_once('master_quangcao.php');?>
</div>
<?php include_once('master_footer.php');?>
</body>
</html>